package edu.tongji.gridding.database;

import java.util.List;
import java.util.Map;

import com.tongji.gridding.hbase.HBaseDao;

public class TitleIndexDao extends BaseDao{
	private static final String DB_NAME = "title_index_data";
	private static final String CF_NAME = "title_index";
	
	private HBaseDao dao = null;
	
	public TitleIndexDao(HBaseDao dao) {
		this.dao = dao;
	}
	
	@Override
	public Map<String, String> getIndexList(String keyword) {
		return dao.queryMapString(DB_NAME, keyword, CF_NAME);
	}
	
	/**
	 * Query titles indexed
	 * @param keyword query results
	 * @param cnt If cnt be negative return all results, else return sublist of the results
	 * @return Empty list or results, never return null
	 */
	public List<String> queryTitle(String keyword, int cnt) {
		return getSortedIndexUrlFPs(keyword, cnt);
	}
}
